package com.hrsoft.modules.bid.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.hrsoft.modules.bid.entity.DepositRefundEntity;
import com.hrsoft.modules.bid.service.DepositRefundService;
import com.hrsoft.common.utils.PageUtils;
import com.hrsoft.common.utils.R;



/**
 * 保证金退回单
 *
 * @author garfield.yue
 * @email yuedefeng101@163.com
 * @date 2020-05-05 16:21:17
 */
@RestController
@RequestMapping("bid/depositrefund")
public class DepositRefundController {
    @Autowired
    private DepositRefundService depositRefundService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("bid:depositrefund:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = depositRefundService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("bid:depositrefund:info")
    public R info(@PathVariable("id") Integer id){
		DepositRefundEntity depositRefund = depositRefundService.getById(id);

        return R.ok().put("depositRefund", depositRefund);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("bid:depositrefund:save")
    public R save(@RequestBody DepositRefundEntity depositRefund){
		depositRefundService.save(depositRefund);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("bid:depositrefund:update")
    public R update(@RequestBody DepositRefundEntity depositRefund){
		depositRefundService.updateById(depositRefund);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("bid:depositrefund:delete")
    public R delete(@RequestBody Integer[] ids){
		depositRefundService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
